package com.atguiguhhhh;

import java.util.*;

public class are {
    public static void main(String[] args) {
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        Integer a = map.put("a", 1);
        System.out.println(a);
        System.out.println(map.put("a",6));
        map.put("b",2);
        map.put("c",3);
        map.put("d",4);
        map.put("e",null);
        //System.out.println(map.put("e",3));

        Set<String> keySet = map.keySet();
        System.out.println("----");
        for (String key : keySet) {
            System.out.println(key+" = "+map.get(key));
        }

//        Iterator<String> iterator = keySet.iterator();
//        while (iterator.hasNext()){
//            System.out.println(map.get(iterator.next()));
//        }

//        Collection<Integer> values = map.values();
//        System.out.println(values);

//        Set<Map.Entry<String, Integer>> entrySet = map.entrySet();
//        Iterator<Map.Entry<String, Integer>> iterator = entrySet.iterator();
//        while(iterator.hasNext()){
//            System.out.println(iterator.next());
//        }
//        for (Map.Entry<String, Integer> entry : entrySet) {
//            System.out.println(entry);
//        }


    }
}
